package ru.fadeev.crammer.data;

import java.util.EventListener;

/**
 * WordsDataListener defines the interface for objects of crammer main data 
 * classes (DictionariesManager, Dictionary, Sheet, Word) that listen for 
 * changes in word data structure.   
 * @author Konstantin Fadeyev
 *
 */
public interface WordsDataListener extends EventListener {
	
	
	/**
	 * Called whenever total number of words in structured object changed
	 * @param change number of words that changed
	 */
	public void wordsCountChanged(int change);
	
	
	/**
	 * Called whenever number of words that need to be tested changed. It happens
	 * when analyzer decide that it's time to test some word (in this case number
	 * of words that need to be tested increases). Or just after some word 
	 * was tested (in this case number of words decreases). 
	 * @param change number of words that changed
	 * @param testType words need to be tested in test specifyed by this testType
	 * @param unchecked true, if analyzer just checked this word for test needs 
	 * for the first time since starting Crammer
	 * @param dictionaryIndex index of dictionary words are placed in
	 * @param sheetIndex index of sheet words are placed in
	 */
	public void testWordsCountChanged(int change, int testType, 
			boolean unchecked, int dictionaryIndex, int sheetIndex);

	
	/**
	 * Called when some new element in structured object was added (new Sheet in
	 * Dictionary, new Dictionary in DictionariesManager)
	 * @param index index of new element
	 */
	public void elementInserted(int index);
}
